﻿using System;
using System.Windows.Forms;

namespace YJKRevitBase.WinForm.WinFormRemindSuit
{
	internal class ControlTypeMangerFactory : IControlTransformerFactory
	{
		public BaseControlTransFormer GetControlTransFormer(ControlPacker inputControl, bool ifIsSpecialValue)
		{
			BaseControlTransFormer result = null;
			if (inputControl.UseCustomFormatter != null)
			{
				result = new CustomControlTransform(inputControl, ifIsSpecialValue);
			}
			else if (inputControl.UseControl is System.Windows.Forms.Form)
			{
				result = new LocationControlTransform(inputControl, ifIsSpecialValue);
			}
			else if (inputControl.UseControl is CheckBox || inputControl.UseControl is RadioButton)
			{
				result = new CheckedControlTransform(inputControl, ifIsSpecialValue);
			}
			else if (inputControl.UseControl is TreeView)
			{
				result = new NodesControlTransform(inputControl, ifIsSpecialValue);
			}
			else if (inputControl.UseControl is ListView || inputControl.UseControl is CheckedListBox || inputControl.UseControl is ListBox)
			{
				result = new ItemsControlTransform(inputControl, ifIsSpecialValue);
			}
			else if (inputControl.UseControl is NumericUpDown)
			{
				result = new ValueControlTransform(inputControl, ifIsSpecialValue);
			}
			else if (inputControl.UseControl is System.Windows.Forms.TextBox || inputControl.UseControl is System.Windows.Forms.ComboBox || inputControl.UseControl is UserControl || inputControl.UseControl is Button)
			{
				result = new TextControlTransform(inputControl, ifIsSpecialValue);
			}
			else if (inputControl.UseControl is PictureBox)
			{
				result = new TagControlTransform(inputControl, ifIsSpecialValue);
			}
			return result;
		}
	}
}
